package com.azxcrm.project.system.basic.service;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.azxcrm.common.utils.StringUtils;
import com.azxcrm.project.system.basic.dao.IOrderModifyRecordDao;
import com.azxcrm.project.system.basic.domain.OrderModifyRecord;
import com.azxcrm.project.system.basic.service.IOrderModifyRecordService;

/**
 * 订单操作记录 服务层实现
 * 
 * @author Dustyone
 * @date 2018-09-17
 */
@Service
public class OrderModifyRecordServiceImpl implements IOrderModifyRecordService 
{
	@Autowired
	private IOrderModifyRecordDao orderModifyRecordDao;
	
	/**
     * 查询订单操作记录信息
     * 
     * @param recordId 订单操作记录ID
     * @return 订单操作记录信息
     */
	 @Override
	public OrderModifyRecord selectOrderModifyRecordById(Integer recordId)
	{
	    return orderModifyRecordDao.selectOrderModifyRecordById(recordId);
	}
	
	/**
     * 查询订单操作记录列表
     * 
     * @param orderModifyRecord 订单操作记录信息
     * @return 订单操作记录集合
     */
	 @Override
	public List<OrderModifyRecord> selectOrderModifyRecordList(OrderModifyRecord orderModifyRecord)
	{
	    return orderModifyRecordDao.selectOrderModifyRecordList(orderModifyRecord);
	}
	
    /**
     * 新增订单操作记录
     * 
     * @param orderModifyRecord 订单操作记录信息
     * @return 结果
     */
	 @Override
	public int insertOrderModifyRecord(OrderModifyRecord orderModifyRecord)
	{
	    return orderModifyRecordDao.insertOrderModifyRecord(orderModifyRecord);
	}
	
	/**
     * 修改订单操作记录
     * 
     * @param orderModifyRecord 订单操作记录信息
     * @return 结果
     */
	 @Override
	public int updateOrderModifyRecord(OrderModifyRecord orderModifyRecord)
	{
	    return orderModifyRecordDao.updateOrderModifyRecord(orderModifyRecord);
	}
	
	/**
     * 保存订单操作记录
     * 
     * @param orderModifyRecord 订单操作记录信息
     * @return 结果
     */
	 @Override
	public int saveOrderModifyRecord(OrderModifyRecord orderModifyRecord)
	{
	    Integer recordId = orderModifyRecord.getRecordId();
		int rows = 0;
		if (StringUtils.isNotNull(recordId))
        {
		    rows = orderModifyRecordDao.updateOrderModifyRecord(orderModifyRecord);
		}
		else
        {
		    rows = orderModifyRecordDao.insertOrderModifyRecord(orderModifyRecord);
		}
		return rows;
	}
	
	/**
     * 删除订单操作记录信息
     * 
     * @param recordId 订单操作记录ID
     * @return 结果
     */
	 @Override
	public int deleteOrderModifyRecordById(Integer recordId)
	{
	    return orderModifyRecordDao.deleteOrderModifyRecordById(recordId);
	}
	
	/**
     * 批量删除订单操作记录对象
     * 
     * @param recordIds 需要删除的数据ID
     * @return 结果
     */
	 @Override
	public int batchDeleteOrderModifyRecord(Integer[] recordIds)
	{
		return orderModifyRecordDao.batchDeleteOrderModifyRecord(recordIds);
	}

	 /**
	 * 根据订单Id查询记录
	 * @param orderId
	 * @return
	 */
	 @Override
	 public OrderModifyRecord selectOrderModifyRecordByOrderId(Integer orderId) 
	 {
		 return orderModifyRecordDao.selectOrderModifyRecordByOrderId(orderId);
	 }
	
}
